Creating Tools
Tools allow your agents to execute Python code, access external systems, and perform actions that language models cannot do on their own. In BindAI, creating a tool is intentionally simple: write a Python function and register it with an agent.The Simplest Tool
A tool is typically a normal Python function decorated with@tool.
Registering a Tool
Register the tool on an agent.Calling a Tool
Suppose the user asks:Tool Parameters
BindAI automatically discovers function parameters. Example:ab
Optional Parameters
Default values become optional parameters.Type Hints
Always provide type hints. Good:Returning Values
Tools can return nearly any Python object. Simple text:Accessing External APIs
Tools are ideal for API integrations. Example:Reading Files
Tools can interact with the file system.Database Queries
Tools can access databases.Using Multiple Tools
Register as many tools as needed.Tool Descriptions
Provide meaningful names and documentation. Example:Tool Context
Advanced tools may receive an execution context. The context can expose:- workflow variables
- runtime state
- metadata
- execution information
Error Handling
Handle expected failures inside the tool. Example:Tool Result Flow
Best Practices
- Give tools descriptive names.
- Keep each tool focused on a single responsibility.
- Use type hints for every parameter.
- Return predictable outputs.
- Handle expected errors gracefully.
- Avoid unnecessary side effects.
- Write clear docstrings and descriptions.
- Reuse tools across multiple agents whenever possible.
